import * as echarts from 'echarts';
type EChartsOption = echarts.EChartsOption;
import { local } from '@/assets/MapData/nanchangLocal';
// import { nanchang } from '@/assets/map/nanchang';
import axios from "axios"
import { jiangxi } from '@/assets/map/jiangxi';

export default async function mapOption2(myChart: echarts.ECharts) {
    myChart&&myChart.showLoading({ text: "",color: "#8870eb" })
    const {data:res} = await axios.get("https://geo.datav.aliyun.com/areas_v3/bound/360000_full.json")
    myChart&&myChart.hideLoading()
    echarts.registerMap("jiangxi",res)
    return {
        title: {
            text: '江西 Chart ',
            subtext: 'Fake Data',
            left: 'center'
        },
        showLegendSymbol: true,
        tooltip: {
            trigger: 'item',
            textStyle: {
                fontSize: 14,
                lineHeight: 22,
            },
            position: point => {
                // 固定在顶部
                return [point[0] + 50, point[1] - 20];
            },
            formatter: '{b}&emsp;&emsp;<br/>{c}'
        },
        geo: [{
            aspectScale: 0.85, //长宽比
            zoom: 1, //缩放
            show: true,
            map: "jiangxi",
            type: "map",
            itemStyle: {
                areaColor: "#2E72BF"
            },
            top:60
        }],
        visualMap: {
            min: 1000000000,
            max: 3000000000,
            text: ['High', 'Low'],
            realtime: false,
            calculable: true,
            inRange: {
              color: ['lightskyblue', 'yellow', 'orangered']
            }
          },
        series: [{
            type: 'map',
            top:60,
            aspectScale: 0.85, //长宽比
            zoom:  1, //缩放
            mapType: 'jiangxi', // 自定义扩展图表类型
            data:jiangxi
        }, 
        ]
    } as EChartsOption;
}

